<!--
 * @Author: TonyJiangWJ
 * @Date: 2020-11-29 13:17:06
 * @Last Modified by: TonyJiangWJ
 * @Last Modified time: 2022-12-05 22:27:31
 * @Description: 
-->
<!DOCTYPE html>
<html lang=en>

<head>
  <meta charset=utf-8>
  <meta http-equiv=X-UA-Compatible content="IE=edge">
  <meta name=viewport content="width=device-width,initial-scale=1">
  <title>配置工具</title>
  <link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/vant@2.10/lib/index.css" />
  <link rel="stylesheet" href="./css/style.css" />
  <script src="https://fastly.jsdelivr.net/npm/vconsole@3.11.2/dist/vconsole.min.js"></script>
  <script>window.vConsole = new VConsole();</script>
  <script src="https://fastly.jsdelivr.net/npm/vue@2.6/dist/vue.min.js"></script>
  <!-- <script src="https://fastly.jsdelivr.net/npm/vue/dist/vue.js"></script> -->
  <script src="https://unpkg.com/vue-router@3.4.9/dist/vue-router.js"></script>
  <script src="https://unpkg.com/vuex@3.6.2/dist/vuex.js"></script>
  <script src="https://fastly.jsdelivr.net/npm/vant@2.10/lib/vant.min.js"></script>
  <script src="https://gw.alipayobjects.com/os/lib/antv/g2/4.1.35/dist/g2.min.js"></script>
</head>

<body>
  <noscript><strong>We're sorry but this doesn't work properly without JavaScript enabled. Please enable
      it to continue.</strong></noscript>
  <div id=app class="root-container" >
    <div>
      <van-nav-bar :title="menuTitle" :left-arrow="showBack" fixed @click-left="onClickBack" class="fixed-bar">
        <template #right>
          <van-icon @click="clickedMenu" class="menu-reference icon-settings" />
        </template>
      </van-nav-bar>
    </div>
    <div>
      <div class="router-container">
        <transition :name="transitionName">
          <router-view class="router-view"></router-view>
        </transition>
      </div>
    </div>
    <van-dialog v-model="showMenuDialog" v-cloak title="菜单" :show-confirm-button="false" :close-on-click-overlay="true"
      :get-container="getDialogContainer">
      <van-divider :style="{ margin: '0' }"></van-divider>
      <van-row type="flex" justify="center" class="van-cell">
        <van-col @click="resetDefaultConfigs">重置所有配置为默认值
        </van-col>
      </van-row>
      <van-divider :style="{ margin: '0' }"></van-divider>
      <van-row type="flex" justify="center" class="van-cell">
        <van-col @click="exportConfigs">导出配置到备份文件
        </van-col>
      </van-row>
      <van-divider :style="{ margin: '0' }"></van-divider>
      <van-row type="flex" justify="center" class="van-cell">
        <van-col @click="restoreConfigs">从备份文件中导入配置</van-col>
      </van-row>
      <van-divider :style="{ margin: '0' }"></van-divider>
      <van-row type="flex" justify="center" class="van-cell">
        <van-col @click="exportRuntimeStorage">导出运行时数据
        </van-col>
      </van-row>
      <van-divider :style="{ margin: '0' }"></van-divider>
      <van-row type="flex" justify="center" class="van-cell">
        <van-col @click="restoreRuntimeStorage">从备份文件中导入运行时数据
        </van-col>
      </van-row>
      <van-divider :style="{ margin: '0' }"></van-divider>
      <van-row type="flex" justify="center" class="van-cell" style="margin-bottom: 2rem;">
        <van-col @click="doUpdate">更新脚本
        </van-col>
      </van-row>
    </van-dialog>
  </div>
</body>
<script type="text/javascript">
  let currentHeight = 0
  let firstResize = true
  /**
   * 禁用长按菜单，复制等 
   **/
  window.addEventListener('contextmenu', function (e) {
    e.preventDefault()
  })
  window.addEventListener('resize', function (e) {
    console.log('页面高度:' + window.innerHeight)
    if (window.innerHeight > 0 && firstResize) {
      firstResize = false
      console.log('修改root height:' + window.innerHeight)
      document.getElementById('app').style.height =  window.innerHeight + 'px'
    }
  }, false);
  // 直接浏览器调试时，mock js bridge方法
  if (typeof $app === 'undefined') {
    window.$app = {
      mock: true,
      invoke: (bridgeName, data, callback) => { },
      receiveMessage: params => { },
      registerFunction: (functionName, func) => { }
    }
    window.$nativeApi = {
      request: (bridgeName, data) => { return Promise.reject({}) }
    }
    setTimeout(() => {
      window.$app.delay_off = true
    }, 5000)
  }
</script>
<script src="./js/jsLoader.js"></script>

</html>